<?php
include "../../inc/log/adsession.php";
include "../../inc/data/connAdmin.php";
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<?php
	$oldmenuName = $_GET['menu'];
	$newMenuN = $_POST["menuname"];
	$Link = $_POST["link"];
	$reMark = $_POST["remark"];
	$tePer = $_POST["tep"];
	$stuPer = $_POST["stu"];
// 1903010328
$sql = "select menuname from mamx_menu where menuname=?";
$stmt=$conn->prepare($sql);
$stmt->bind_param("s",$newMenuN);
$stmt->execute();
$stmt->bind_result($menuName);
$stmt->store_result();
if ($stmt->fetch()) {
	echo <<<END
	<script type="text/javascript">
	alert("菜单重名,添加失败，请重新添加！");
	history.back();
	</script>
END;
}else{
	$sql1="update mamx_menu
			set menuname=?,link=?,remark=?,tePre=?,stuPre=?
			where menuname=?";
	$stmt1=$conn->prepare($sql1);
	$stmt1->bind_param("ssssss",$newMenuN,$Link,$reMark,$tePer,$stuPer,$oldmenuName);
	$stmt1->execute();
	if ($stmt1->affected_rows==1) {
				echo <<<END
				<script type="text/javascript">
				alert("菜单修改成功！");
				location="menuAdmin.php";
				</script>
END;
			}	
}
// 
?>
</body>
</html>